import scrapy


class FirstSpider(scrapy.Spider):
    # 爬虫文件名称：爬虫源文件的唯一标识
    name = 'first'
    # 允许的域名：用来限定start url中那些url可以发送，通常会被屏蔽，不用该功能
    # allowed_domains = ['www.baidu.com']
    # 起始Url列表：该列表中存放的url会被scrapy自动请求发送
    start_urls = ['https://www.baidu.com/s?wd=ip']
    # 用于数据解析
    def parse(self, response):
        page_text = response.text
        with open('./baoidu.html','w',encoding='utf-8') as f:
             f.write(page_text)
